package mushystuff.dtb.core.dao.hibernate;

import java.util.List;

import org.springframework.stereotype.Repository;

import mushystuff.dtb.core.dao.ProductDAO;
import mushystuff.dtb.core.model.Product;

@Repository
public final class ProductDAOImpl extends GenericHibernateDAO<Product, Long>
        implements ProductDAO {

    @Override
    public Product persistProduct(Product product) {
        log.info("Persisting "  + product);
        return makePersistent(product);
    }

    @Override
    public Product getProduct(long productId) {
        return findById(productId, false);
    }

    @Override
    public List<Product> getAllProducts() {
        return findAll();
    }

}
